package com.chat.biz.service.Impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chat.api.dto.ChatMessageDTO;
import com.chat.api.entity.ChatMessageEntity;
import com.chat.biz.mapper.ChatMessageMapper;
import org.springframework.stereotype.Service;

/*
*功能：
 作者：chenhao
*日期： 2025/6/17 下午8:54
*/
@Service
public class ChatMessageService extends ServiceImpl<ChatMessageMapper, ChatMessageEntity> {
    /**
     * 保存消息
     *
     * @param dto 到
     */
    public void saveMessage(ChatMessageDTO dto) {
        ChatMessageEntity entity = ChatMessageEntity.builder()
                .senderId(dto.getSenderId())
                .receiverId(dto.getReceiverId())
                .chatType(dto.getChatType())
                .messageType(dto.getMessageType())
                .content(dto.getContent())
                .isRecalled(0)
                .status(1)
                .isDeleted(false).build();
        this.save(entity);
    }

}
